package com.zs.lib_base.ext

import com.zs.lib_base.utils.GlobalGson


inline fun <T> T.isNull(block: T.() -> Unit): T {
    if (this == null)
        block()
    return this
}

inline fun <T> T.isNotNull(block: T.() -> Unit): T {
    if (this != null)
        block()
    return this
}

inline fun <T> T.isTrue(block: T.() -> Unit): T {
    if (this == true)
        block()
    return this
}

inline fun <T> T.isFalse(block: T.() -> Unit): T {
    if (this == false)
        block()
    return this
}

fun Any.toJson(): String {
    return GlobalGson.gson.toJson(this)
}


